package time.after.time.web.pro;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springside.modules.utils.web.struts2.Struts2Utils;

import time.after.time.entity.pro.Info;
import time.after.time.service.pro.InfoManager;
import time.after.time.sys.utils.Result;
import time.after.time.sys.utils.Utils;
import time.after.time.web.BaseActionSupport;

/**
 * 
 * @author HuMing create in 2013-3-30
 */
public class SearchAction extends BaseActionSupport
{
	private static final long serialVersionUID = 1L;
	
	private String citys;
	private String afterWhen;
	private String infoType;
	
	@Autowired
	private InfoManager infoManager;
	
	private List<Info> infos;
	
	@Override
	public String execute() 
	{
		infos=infoManager.query(citys,Utils.isFullDate(afterWhen)?afterWhen:Utils.getSimpleDate()+" 00:00:00",infoType);
		Struts2Utils.renderJson(new Result(200,"ok",infos));
		return null;
	}	
	
	public void setCitys(String citys) {
		this.citys = citys;
	}
	public void setAfterWhen(String afterWhen) {
		this.afterWhen = afterWhen;
	}
	public void setInfoType(String infoType) {
		this.infoType = infoType;
	}
	
	public List<Info> getInfos() {
		return infos;
	}
}
